package be.kuleuven.cs.mop.domain.model.impl;

import be.kuleuven.cs.mop.domain.model.TaskStatus;



/**
 * Independant {@link TaskState} implementation used for loading XML data
 * Used to disable business rules while parsing XML data
 */
public class TaskStateInitial extends TaskState {

	protected TaskStateInitial(final TaskImpl task) {
		super(task);
	}

	
	
	/**
	 * Disable default business rule checks
	 */
	@Override
	public void onTimeChanged(final Clock time) {
	}
	
	/**
	 * Disable business rule checks
	 */
	@Override
	public void setFailedSafely() {
		super.setFailed();
	}
	
	/**
	 * Disable business rule checks
	 */
	@Override
	public void setSuccessfulSafely() {
		super.setSuccessful();
	}
	
	/**
	 * Disable business rule checks
	 */
	@Override
	public void setUnfinishedSafely() {
		super.setUnfinished();
	}
	
	/**
	 * Initial state always needs to be modified
	 * This state is only used to ignore business rules at the starting point of the application
	 */
	@Override
	public boolean isModifiable() { return true; }
	
	/**
	 * Should never be called
	 */
	@Override
	public TaskStatus toStatus() {
		throw new UnsupportedOperationException(
				"The initial TaskState has no TaskStatus equivalent");
	}
}